/**
 * Created by firefoxmmx2 on 17-3-15.
 */
Ext.define('extjs6test.view.core.DictManager',{
    extend: 'extjs6test.view.base.BaseManager',
    requires: [
        'extjs6test.view.core.DictGrid',
        'extjs6test.view.core.DictManagerController'
    ],
    alias: 'widget.dictmngr',
    controller: {
        type: 'dictmngr'
    },
    layout: 'fit',
    bind: {
        title: '{dictManager.title}'
    },
    glyph: 'xf0f2@FontAwesome',
    items: [
        {
            xtype: 'dictgrid',
            reference: 'dictGrid'
        }
    ],
    initComponent: function () {
        Ext.apply(this, {
            dockedItems: this.dockedItems.concat([{
                dock: 'top',
                xtype: 'toolbar',
                items: [
                    {
                        xtype: 'form',
                        layout: 'column',
                        reference: 'queryForm',
                        defaults: {
                            padding: '0 8 0 0'
                        },
                        items: [
                            {
                                xtype: 'textfield',
                                bind: {
                                    fieldLabel: '{dictManager.queryBar.dictCodeLabel}'
                                },
                                name: 'dictCode',
                                minLength: 1,
                                maxLength: 20
                            },
                            {
                                xtype: 'textfield',
                                bind: {
                                    fieldLabel: '{dictManager.queryBar.dictNameLabel}'
                                },
                                name: 'dictName',
                                minLength: 1,
                                maxLength: 30
                            },
                            {
                                name: "dictType",
                                fieldLabel: "Dict Type",
                                xtype: 'combo',
                                store: Ext.create('Ext.data.Store', {
                                    fields: [
                                        {name: "value"},
                                        {name: "display"}
                                    ],
                                    data: [
                                        {value: "0", display: "简单"},
                                        {value: "1", display: "树型"}
                                    ]
                                }),
                                editable: false,
                                queryMode: "local",
                                valueField: "value",
                                displayField: "display"
                            }
                        ]
                    }
                ]
            }])
        });
        this.callParent(arguments);
    }
});